namespace game {
    export namespace gameLogin {
        export class MainComponent extends cc.Component {
            async onLoad() {
                //获取模块初始化的进度
                var progress = lib.DataManager.createData("ProgressData");
                progress.current = progress.max = 1;
                //调用模块初始化消息
                mainMediator.sendNotification(common.Command.ENTER_GAME_LOADING, progress);
                var max = 1;
                if (progress.percent != max) { //如果模块初始化已完成
                    await progress.percentValue.valueEqual(max);
                }
                this.loginBack();
            }

            loginBack() {
                this.quit();
            }

            quit() {
                ///是否第一次进入游戏 <或者清理过缓存>
                //let checklocal_key = "localplayer"
                //let local_oldplayer = cc.sys.localStorage.getItem(checklocal_key);
                this.start2game("localstart")
     
               // cc.sys.localStorage.setItem(checklocal_key, true);
            }
            //进入游戏界面
            start2game(entertype: string) {
                new gameData.GameDataModule().InitGameData()


                //声音 
                game.data.game.soundstate = true

                ///开始冒险吧!~~~
                //mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("playGame"));
               // setTimeout(() => {
               //     mainMediator.sendNotification(common.Command.CHANGE_SCENE, new common.ChangeSceneNB("gameStart"));
              //  }, 200);

            }
        }
    }

}